#include <string>
#include <vector>
#include <fstream>
#include <iostream>

using namespace std;

class CowSignal {
  int m; // rows
  int n; // cols
  vector<vector<char>> signal;

public:
  CowSignal(int r, int c, vector<vector<char>> g)
    :m(r), n(c), signal(g) {}

  vector<vector<char>> scale(int k) {
    vector<vector<char>> result;
    for (vector<char> row : signal) {
      vector<char> line;

      for (char c : row) {
        for (int i = 0; i < k; ++i) {
          line.push_back(c);
        }
      }

      for (int i = 0; i < k; ++i) {
        result.push_back(line);
      }
    }

    return result;
  }
};

int main(int argc, char const *argv[])
{
  /* code */
  int m = 5, n = 4;
  vector<vector<char>> g {
    {'X', 'X', 'X', '.'},
    {'X', '.', '.', 'X'},
    {'X', 'X', 'X', '.'},
    {'X', '.', '.', 'X'},
    {'X', 'X', 'X', '.'}
  };

  CowSignal cs(m, n, g);
  auto result = cs.scale(3);

  for (auto row : result) {
    for (char c : row) {
      cout << c << " ";
    }
    cout << endl;
  }

  cout << endl;
  return 0;
}
